import Vue from 'vue'
import Router from 'vue-router'
import index from '../components/index'
import searchpage from '../components/searchpage'
import limit from '../components/limit'
import limitDetail from '../components/limit-detail'
import fresh from '../components/fresh'
import specialty from '../components/specialty'
import news from '../components/news'
import newsDetail from '../components/news-detail'
import about from '../components/about'
import info from '../components/info'
import distribution from '../components/distribution'
import login from '../components/login'
import reg from '../components/reg'
import forget from '../components/forget'
import freshDetail from '../components/fresh-detail'
import specialtyDetail from '../components/specialty-detail'
import buysteps from '../components/buysteps'
import buypage from '../components/buypage'
import person from '../components/person'
import basicInfo from '../components/personal/basicInfo'
import myshopcar from '../components/personal/myshopcar'
import mycode from '../components/personal/mycode'
/*订单*/
import order from '../components/personal/order'
import allorder from '../components/personal/allorder'
import noorder from '../components/personal/noorder'
import doneorder from '../components/personal/doneorder'
import yshorder from '../components/personal/yshorder'
import dfhorder from '../components/personal/dfhorder'
import comment from '../components/personal/comment'
import look from '../components/personal/look'

import xgpassword from '../components/personal/xgpassword'
import shaddress from '../components/personal/shaddress'
import mydistribution from '../components/personal/mydistribution'
import txpage from '../components/personal/txpage'



Vue.use(Router)



export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'index',
      component: index
    },
    {
      path: '/searchpage',
      name: 'searchpage',
      component: searchpage
    },
    {
      path: '/limit',
      name: 'limit',
      component: limit
    },
    {
      path: '/limit/limit-detail',
      name: 'limitDetail',
      component: limitDetail
    },
    {
      path: '/fresh',
      name: 'fresh',
      component: fresh
    },
    {
      path: '/fresh/fresh-detail',
      name: 'freshDetail',
      component: freshDetail
    },
    {
      path: '/specialty/specialty-detail',
      name: 'specialtyDetail',
      component: specialtyDetail
    },
    {
      path: '/specialty',
      name: 'specialty',
      component: specialty
    },
    {
      path: '/news',
      name: 'news',
      component: news
    },
    {
      path: '/news/news-detail',
      name: 'newsDetail',
      component: newsDetail
    },
    {
      path: '/about',
      name: 'about',
      component: about
    },
    {
      path: '/info',
      name: 'info',
      component: info
    },
    {
      path: '/distribution',
      name: 'distribution',
      component: distribution
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/reg',
      name: 'reg',
      component: reg
    },
    {
      path: '/forget',
      name: 'forget',
      component: forget
    },
    {
      path: '/buysteps',
      name: 'buysteps',
      component: buysteps
    },
    {
      path: '/buypage',
      name: 'buypage',
      component: buypage
    },
    {
      path: '/person',
      name: 'person',
      component: person,
      redirect: '/person/basicInfo',
      children:[
          { path: 'basicInfo', component: basicInfo},
          { path: 'myshopcar', component: myshopcar},
          { 
            path: 'order', 
            component: order,
            name: 'order',
            redirect: 'order/all-order',
            children:[
              { path: 'all-order', component: allorder},
              { path: 'no-order', component: noorder},
              { path: 'done-order', component: doneorder},
              { path: 'ysh-order', component: yshorder},
              { path: 'dfh-order', component: dfhorder}
            ]
          },
          { path: 'xgpassword', component: xgpassword},
          { path: 'shaddress', component: shaddress},
          { path: 'comment', component: comment},
          { path: 'look', component: look},
          { path: 'mycode', component: mycode},
          { path: 'mydistribution', component: mydistribution},
          { path: 'txpage', component: txpage}
      ]
    }
  ],
  scrollBehavior(to, from,savedPosition) {  
      return {  
        x: 0,  
        y: 0  
      }  
  }
})